import CustomerInfoManageServer from "@/api/customer/CustomerInfoManageServer";
const user = {
	namespaced: true,
	state: {
		user: null
	},

	mutations: {
		SET_USER: (state, myval) => {
			state.user = myval;
		},
	},

	actions: {
		/**
		 * 查询用户信息
		 */
		async queryLoginUserInfo({ commit }) {
			let res = await CustomerInfoManageServer.getLoginUserInfo();
			res.meta.sysUserId = res.meta.acctId;
			res.meta.commonRegionId = res.meta.regionId;
			commit("SET_USER", res.meta);
			sessionStorage.setItem("crm3-userinfo", JSON.stringify(res.meta));
		},
	},
};

export default user;
